package com.tp7567.domain;

import java.io.Serializable;
import java.util.List;
import com.google.common.collect.Lists;

/**
 * 
 * @author Maxi Rosson
 */
public class AutismLevelDescription implements Serializable {
	
	private String type;
	private List<Sintoma> sintomas;
	
	public AutismLevelDescription(String type, Sintoma... sintomas) {
		this.type = type;
		this.sintomas = Lists.newArrayList(sintomas);
	}
	
	/**
	 * @return the sintomas
	 */
	public List<Sintoma> getSintomas() {
		return sintomas;
	}
	
	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}
	
	public boolean matches(List<Sintoma> selectedSintomas) {
		for (Sintoma sintoma : sintomas) {
			if (selectedSintomas.contains(sintoma)) {
				return true;
			}
		}
		return false;
	}
	
	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		for (Sintoma sintoma : sintomas) {
			sb.append(sintoma.getName());
			sb.append(", ");
		}
		sb.replace(sb.length() - 2, sb.length(), "");
		return sb.toString();
	}
}
